var mongoose = require('mongoose');
var Schema = mongoose.Schema;





var Monitor = new Schema({
  id: String,
  name:  String,
  url: String,
  owner: [{type: String}],
  created: { type: Date, default: Date.now },
  status: { type: Number, default: 0 },
  tags:[{type: String}],
  autoStart: { type: Boolean, default: false },
  avail: { type: Number, default: 100 },
  interval: { type: Number, default: 5000 }
});

var Log = new Schema({
  mid: String,
  url: String,
  created: { type: Date, default: Date.now },
  log: Schema.Types.Mixed
});

var User = new Schema({
  id: String,
  name:  String,
  email: String,
  phone: String,
  created: { type: Date, default: Date.now },
  groups: [{type: String}]
});

mongoose.model('Monitor',Monitor);
mongoose.model('User',User);
mongoose.model('Log',Log);

